/*
 * @(#)HttpStatusCode.java	1.0 Mar 8, 2008
 *
 *	The MIT License
 *
 *	Copyright (c) 2008 Malachi de AElfweald <malachid@gmail.com>
 *
 *	Permission is hereby granted, free of charge, to any person obtaining a copy
 *	of this software and associated documentation files (the "Software"), to deal
 *	in the Software without restriction, including without limitation the rights
 *	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *	copies of the Software, and to permit persons to whom the Software is
 *	furnished to do so, subject to the following conditions:
 *
 *	The above copyright notice and this permission notice shall be included in
 *	all copies or substantial portions of the Software.
 *
 *	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *	THE SOFTWARE.
 */
package org.eoti.net.http;

import static org.eoti.net.http.HttpStatusType.*;

public enum HttpStatusCode
{
	Ok(Success, 200, "OK"),													// Found, Sending
	Created(Success, 201, "CREATED"),										// Created by 'PUT'
	Accepted(Success, 202, "ACCEPTED"),										// Process later
	NonAuthoritative(Success, 203, "NON-AUTHORITATIVE"),					// Nonauthoritative Mirror
	NoContent(Success, 204, "NO CONTENT"),									// Success, but no content to display
	ResetContent(Success, 205, "RESET CONTENT"),							// Reset Content
	PartialContent(Success, 206, "PARTIAL CONTENT"),						// Part of the document follows

	MultipleChoices(Choices, 300, "MULTIPLE CHOICES"),						//used in content negotiation
	MovedPermanently(Choices, 301, "MOVED PERMANENTLY"),					// aka. Moved - new URI
	MovedTemporarily(Choices, 302, "MOVED TEMPORARILY"),					// aka. Redirect - new URI
	SeeOther(Choices, 303, "UNKNOWN"),										// aka. Change POST to GET
	NotModified(Choices, 304, "NOT MODIFIED"),								// aka. USE_LOCAL_COPY

	BadRequest(ClientError, 400, "BAD REQUEST"),							// aka. INVALID_REQUEST -- request contains syntax error
	Unauthorized(ClientError, 401, "UNAUTHORIZED"),							// aka. AUTH_REQUIRED -- did not provide correct authentication info
	PaymentRequired(ClientError, 402, "PAYMENT REQUIRED"),					// used in charging schemes
	Forbidden(ClientError, 403, "FORBIDDEN"),								// not allowed to access this document
	NotFound(ClientError, 404, "NOT FOUND"),								// aka. PAGE_NOT_FOUND
	MethodNotAllowed(ClientError, 405, "METHOD NOT ALLOWED"),				// method (PUT/etc) now allowed here
	NotAcceptable(ClientError, 406, "NOT ACCEPTABLE"),						// request not acceptable
	ProxyAuthenticationRequired(ClientError, 407, "PROXY AUTHENTICATION REQUIRED"),// proxy server must provide authentication
	RequestTimeOut(ClientError, 408, "REQUEST TIMED OUT"),					// client waited too long
	Conflict(ClientError, 409, "CONFLICT"),									// Conflict
	Gone(ClientError, 410, "GONE"),											// document permanently removed
	LengthRequired(ClientError, 411, "LENGTH REQUIRED"),					// ????
	PreconditionFailed(ClientError, 412, "PRECONDITION FAILED"),			// conditional retrieval of the document failed
	RequestEntityTooLarge(ClientError, 413, "REQUEST ENTITY TOO LARGE"),	// client tried to PUT/POST data that was too long
	RequestURITooLarge(ClientError, 414, "REQUEST URI TOO LARGE"),			// client tried to fetch a URL that was too long
	UnsupportedMediaType(ClientError, 415, "UNSUPPORTED MEDIA TYPE"),		// client tried to PUT/POST data using an unsupported MIME type

	InternalServerError(ServerError, 500, "INTERNAL SERVER ERROR"),			// unexpected error
	NotImplemented(ServerError, 501, "NOT IMPLEMENTED"),					// HTTP feature unimplemented
	BadGateway(ServerError, 502, "BAD GATEWAY"),							// error occured in remote server during proxy request
	ServiceUnavailable(ServerError, 503, "SERVICE UNAVAILABLE"),			// server temporarily down
	GatewayTimeOut(ServerError, 504, "GATEWAY TIMED OUT"),					// remote server timed out during proxy request
	VersionNotSupported(ServerError, 505, "VERSION NOT SUPPORTED"),			// server doesn't support this version of HTTP
	VariantAlsoVaries(ServerError, 506, "VARIANT ALSO VARIES");				// negotiated document has several alternative representations

	HttpStatusCode(HttpStatusType type, int num, String msg)
	{
		this.type = type;
		this.num = num;
		this.msg = msg;
	}
	protected HttpStatusType type;
	protected int num;
	protected String msg;
	public HttpStatusType getType(){return type;}
	public int getNumber(){return num;}
	public String getMessage(){return msg;}
}
